import request from '@/utils/request'

// 查询销售订单列表
export function listOrder(query) {
  return request({
    url: '/mes/xs/order/list',
    method: 'get',
    params: query
  })
}

// 查询销售订单详细
export function getOrder(soId) {
  return request({
    url: '/mes/xs/order/' + soId,
    method: 'get'
  })
}

// 新增销售订单
export function addOrder(data) {
  return request({
    url: '/mes/xs/order',
    method: 'post',
    data: data
  })
}

// 修改销售订单
export function updateOrder(data) {
  return request({
    url: '/mes/xs/order',
    method: 'put',
    data: data
  })
}

// 删除销售订单
export function delOrder(soId) {
  return request({
    url: '/mes/xs/order/' + soId,
    method: 'delete'
  })
}

// 审批销售订单
export function passOrder(data) {
  return request({
    url: '/mes/xs/order/pass',
    method: 'post',
    data: data
  })
}
export function confirmOrder(id) {
  return request({
    url: '/mes/xs/order/confirm/'+id,
    method: 'put'
  })

}
// 按状态查询销售订单
export function listStatusOrder(query) {
  return request({
    url: '/mes/xs/order/status',
    method: 'get',
    params: query
  })
}

// 审批列表
export function listApproveOrder(query) {
  return request({
    url: '/mes/xs/order/approveList',
    method: 'get',
    params: query
  })
}
//审批流程
export function approveFlow(orderNumber) {
  return request({
    url: '/mes/xs/order/approveFlow/' + orderNumber,
    method: 'get'
  })
}
//审批
export function approve(data) {
  return request({
    url: '/mes/xs/order/approve',
    method: 'put',
    data: data
  })
}
